package com.tim.helper.project.history;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Collectors;

public class YiYaTongHelper {
    @Test
    public void extractJsonField() throws IOException {
    String content =
        Files.readAllLines(Paths.get("C:\\Users\\Administrator\\Desktop\\file.txt")).stream()
            .collect(Collectors.joining("\n"));
        JSONObject json = JSON.parseObject(content);
        json.getJSONObject("data")
                .getJSONArray("list")
                .forEach(e->{
                    System.out.println(((JSONObject)e).getString("category3_id"));
                });

    }
}
